package com.jack.design_patterns.creational.single;

/**
 * 饿汉式单例-同步方法
 *  优点：解决了线程同步的问题
 *  缺点：效率比较低效
 */
public class SynchronizeLazySingleton {

    private static SynchronizeLazySingleton INSTANCE;

    private SynchronizeLazySingleton() {

    }

    public synchronized static SynchronizeLazySingleton getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new SynchronizeLazySingleton();
        }
        return INSTANCE;
    }
}
